import type { SaleOrderGiftVO, SaleOrderGiftForm, SaleOrderGiftQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
* 查询订单赠品明细列表
* @param params
* @returns 订单赠品明细列表
*/
export function saleOrderGiftList(params?: SaleOrderGiftQuery) {
  return requestClient.get<PageResult<SaleOrderGiftVO>>('/system/saleOrderGift/list', { params });
}

/**
 * 导出订单赠品明细列表
 * @param params
 * @returns 订单赠品明细列表
 */
export function saleOrderGiftExport(params?: SaleOrderGiftQuery) {
  return commonExport('/system/saleOrderGift/export', params ?? {});
}

/**
 * 查询订单赠品明细详情
 * @param giftId id
 * @returns 订单赠品明细详情
 */
export function saleOrderGiftInfo(giftId: ID) {
  return requestClient.get<SaleOrderGiftVO>(`/system/saleOrderGift/${giftId}`);
}

/**
 * 新增订单赠品明细
 * @param data
 * @returns void
 */
export function saleOrderGiftAdd(data: SaleOrderGiftForm) {
  return requestClient.postWithMsg<void>('/system/saleOrderGift', data);
}

/**
 * 更新订单赠品明细
 * @param data
 * @returns void
 */
export function saleOrderGiftUpdate(data: SaleOrderGiftForm) {
  return requestClient.putWithMsg<void>('/system/saleOrderGift', data);
}

/**
 * 删除订单赠品明细
 * @param giftId id
 * @returns void
 */
export function saleOrderGiftRemove(giftId: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/system/saleOrderGift/${giftId}`);
}
